package com.study;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.study.service.ClassesService;
import com.study.service.StudentService;

public class TestApp {
	private StudentService studentService;
	private ClassesService classesService;
	
	@Before
	public void init(){
		try{
			ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
			studentService = ctx.getBean(StudentService.class);
			classesService = ctx.getBean(ClassesService.class);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	@Test
	public void testF(){
		
		try{
//		studentService.delete(2);
		System.out.println("xxx"+studentService.queryAll());
		System.out.println("yyy"+studentService.queryById(2));
		//
//			classesService.delete(2);
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}
	
	@After
	public void destroy(){
		System.out.println("the end");
	}
}
